<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TaskType
 *
 * @author QuangKhoi
 */
class TaskType {
    public static function getName($id) {
        $db = Database::getInstance();
        $result = $db->query("SELECT * FROM tasktype WHERE id='$id'");
        if ($result->returnCode == 200) {
            if ($result->dataTable->numOfRow == 1) {
                $row = $result->dataTable->rows[0];
                return $row["name"];
            }
        }
    }
    
    public static function listName() {
        $db = Database::getInstance();
        $result = $db->query("SELECT * FROM tasktype");
        if ($result->returnCode == 200) {
            if ($result->dataTable->numOfRow > 0) {
                $listResult = array();
                foreach($result->dataTable->rows as $row) {
                    $listResult[] = $row;
                }
                return $listResult;
            }
        }
    }
}

?>
